package generator.domain;

import java.time.LocalDateTime;
import lombok.Data;

/**
 * 
 * @TableName user_favorites
 */
@Data
public class UserFavorites {
    /**
     * 收藏记录主键
     */
    private Integer id;

    /**
     * 关联用户ID（业务层校验）
     */
    private Integer userId;

    /**
     * 收藏类型
     */
    private Object favoriteType;

    /**
     * 收藏对象ID（关联对应表ID）
     */
    private Integer favoriteId;

    /**
     * 收藏时间
     */
    private LocalDateTime favoriteTime;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        UserFavorites other = (UserFavorites) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getFavoriteType() == null ? other.getFavoriteType() == null : this.getFavoriteType().equals(other.getFavoriteType()))
            && (this.getFavoriteId() == null ? other.getFavoriteId() == null : this.getFavoriteId().equals(other.getFavoriteId()))
            && (this.getFavoriteTime() == null ? other.getFavoriteTime() == null : this.getFavoriteTime().equals(other.getFavoriteTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getFavoriteType() == null) ? 0 : getFavoriteType().hashCode());
        result = prime * result + ((getFavoriteId() == null) ? 0 : getFavoriteId().hashCode());
        result = prime * result + ((getFavoriteTime() == null) ? 0 : getFavoriteTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", userId=").append(userId);
        sb.append(", favoriteType=").append(favoriteType);
        sb.append(", favoriteId=").append(favoriteId);
        sb.append(", favoriteTime=").append(favoriteTime);
        sb.append("]");
        return sb.toString();
    }
}